package com.ruoyi.whzj.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.whzj.mapper.WhIntegralHistoryMapper;
import com.ruoyi.whzj.domain.WhIntegralHistory;
import com.ruoyi.whzj.service.IWhIntegralHistoryService;
import com.ruoyi.common.core.text.Convert;

/**
 * 积分明细  历史记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-10-19
 */
@Service
public class WhIntegralHistoryServiceImpl implements IWhIntegralHistoryService 
{
    @Autowired
    private WhIntegralHistoryMapper whIntegralHistoryMapper;

    /**
     * 查询积分明细  历史记录
     * 
     * @param id 积分明细  历史记录ID
     * @return 积分明细  历史记录
     */
    @Override
    public WhIntegralHistory selectWhIntegralHistoryById(String id)
    {
        return whIntegralHistoryMapper.selectWhIntegralHistoryById(id);
    }

    @Override
    public WhIntegralHistory getHistoryByUserId(String userId)
    {
        return whIntegralHistoryMapper.getHistoryByUserId(userId);
    }

    /**
     * 查询积分明细  历史记录列表
     * 
     * @param whIntegralHistory 积分明细  历史记录
     * @return 积分明细  历史记录
     */
    @Override
    public List<WhIntegralHistory> selectWhIntegralHistoryList(WhIntegralHistory whIntegralHistory)
    {
        return whIntegralHistoryMapper.selectWhIntegralHistoryList(whIntegralHistory);
    }

    /**
     * 新增积分明细  历史记录
     * 
     * @param whIntegralHistory 积分明细  历史记录
     * @return 结果
     */
    @Override
    public int insertWhIntegralHistory(WhIntegralHistory whIntegralHistory)
    {
        whIntegralHistory.setId(IdWorker.getId());
        whIntegralHistory.setCreateTime(DateUtils.getNowDate());
        return whIntegralHistoryMapper.insertWhIntegralHistory(whIntegralHistory);
    }

    /**
     * 修改积分明细  历史记录
     * 
     * @param whIntegralHistory 积分明细  历史记录
     * @return 结果
     */
    @Override
    public int updateWhIntegralHistory(WhIntegralHistory whIntegralHistory)
    {
        return whIntegralHistoryMapper.updateWhIntegralHistory(whIntegralHistory);
    }

    /**
     * 删除积分明细  历史记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWhIntegralHistoryByIds(String ids)
    {
        return whIntegralHistoryMapper.deleteWhIntegralHistoryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除积分明细  历史记录信息
     * 
     * @param id 积分明细  历史记录ID
     * @return 结果
     */
    @Override
    public int deleteWhIntegralHistoryById(String id)
    {
        return whIntegralHistoryMapper.deleteWhIntegralHistoryById(id);
    }

    public Map selectIntegralInvitation(String userId, String operat){
        return whIntegralHistoryMapper.selectIntegralInvitation(userId, operat);
    }
}
